package com.ruoyi.project.records.controller;

import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.project.records.domain.CheckRecords;
import com.ruoyi.project.records.service.ICheckRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/records/checkRecords")
public class CheckRecordsController extends BaseController {
    @Autowired
    private ICheckRecordsService checkRecordsService;

    //根据项目名称，患者姓名，检查时间动态查询检查项目列表信息
    @RequestMapping("/list")
    @PreAuthorize("@ss.hasPermi('records:checkRecords:list')")
    public TableDataInfo checkRecordsList(CheckRecords checkRecords){
        String examName = checkRecords.getExamName();
        String patiName = checkRecords.getPatiName();
        Map<String, Object> params = checkRecords.getParams();
        List<CheckRecords> list = checkRecordsService.selCheckRecordsInfo(examName,patiName,params);
        return getDataTable(list);
    }

    //根据项目名称和检查时间动态查询检查项目统计列表
    @RequestMapping("/sum")
    @PreAuthorize("@ss.hasPermi('records:checkRecords:sum')")
    public TableDataInfo checkRecordsSum(CheckRecords checkRecords){
        String examName = checkRecords.getExamName();
        Map<String, Object> params = checkRecords.getParams();
        List<CheckRecords> checkRecords1 = checkRecordsService.selCheckRecordsSum(examName, params);
        return getDataTable(checkRecords1);

    }

}
